<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<?php
if(!isset($_SESSION)){
	session_start();
}

if(!isset($_SESSION["adminName"]) || (empty($_SESSION["adminName"]))){
	header ("Location: ../index.php");
}
?>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Add Page</title>
    <link href="../../Styles/adminstype.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../js/admin_script.js"></script>
</head>
<body>
<table>
	<tr class="boxContentTitle">
		<td>Thêm sản phẩm</td>
	</tr>
	<tr>
		<td>
			 <form action="resource/form_add_category.php" method="post" name="form_add_category">
				<table class="tableBoxView">
					<tr>
						<td style="width: 200px"><td>
						<td style="width: 200px">Tên loại sản phẩm</td>
						<td><input type="text" maxlength="300" name="txtTen" id="txtTen" /></td>
					</tr>
					<tr>
						<td><td>
						<td></td>
						<td><input type="submit" name="btnThemLoai" value="Save" onclick="return kiemTraTxt('txtTen')"/></td>
					</tr>
				</table>
			</form>
		</td>
	</tr>
	<tr>
		<td>
			<?php
			if(!empty($_REQUEST["btnThemLoai"]))//có yeu cau them
			{
				$ten = $_REQUEST["txtTen"];
				if($ten != "") // không chấp nhận kiểm tra 
				{
					$sql = "insert into loaisanpham(TenLoaiSanPham, BiXoa) values('$ten', 0)";
					
					require_once "../../database/DataProvider.php";
					$result =  DataProvider::ExecuteQuery($sql);
					echo($result);
					
					if(!empty($result))
					{
					}
				}
				header ("Location: ../admin_manager_category.php");
			}
			?>
		</td>
	</tr>
</table>
</body>
</html>